package com.gupaoedu.vip;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author: JLL
 * @Date: 2019/6/17 21:03
 */
public class RpcProxyServer {


    private ExecutorService executorService = Executors.newCachedThreadPool();


    public void publisher(Object service ,int port){
        ServerSocket serverSocket =  null;
        Socket socket = null;
        try {
            serverSocket = new ServerSocket(port);
            while (true){ //不断接收请求
                socket = serverSocket.accept(); //BIO
//                ProcessorHandler command  = new ProcessorHandler(socket,service);
//                executorService.execute(command);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                socket.close();
                serverSocket.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}
